package day009.oop_extends;

import javax.swing.*;

public class UserLoginFrame extends javax.swing.JFrame {
    public UserLoginFrame() {
        initFrame();
        paintView();
        this.setVisible(true);
    }

    public void paintView() {
        JLabel usernameLabel = new JLabel("用户名");
        usernameLabel.setBounds(50, 50, 50, 20);
        this.add(usernameLabel);

        JTextField usernameField = new JTextField();
        usernameField.setBounds(150, 50, 180, 20);
        this.add(usernameField);

        JLabel passwordLabel = new JLabel("密码");
        passwordLabel.setBounds(50, 100, 50, 20);
        this.add(passwordLabel);

        JTextField passwordField = new JTextField();
        passwordField.setBounds(150, 100, 180, 20);
        this.add(passwordField);

        JButton loginButton = new JButton("登录");
        loginButton.setBounds(50, 200, 280, 20);
        this.add(loginButton);
    }

    public void initFrame() {
        this.setTitle("用户登录");
        this.setSize(400, 300);
        this.setDefaultCloseOperation(3);
        this.setLocationRelativeTo(null);
        this.setAlwaysOnTop(true);
        this.setLayout(null);
    }
}
